<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>[Generic Component Framework v3] GCF Investigator</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<!--link href="tabs.css" rel="stylesheet" type="text/css"-->
</head><body>
 <div id="wrapper">
    <div id="logo_box">
        <a class="img_link" href="https://github.com/pnudupa/gcf" target="_blank" ><img style="float:left;margin-left:10px;margin-top:5px;margin-bottom:5px;"src="header_gcf_logo.jpg" alt="GCF LOGO"/></a>
        <a class="img_link" href="https://www.vcreatelogic.com/" target="_blank" ><img style="float:right;margin-right:10px; margin-top: 30px;" src="header_vcl_logo.jpg" alt="VCL LOGO"/></a>
        <div style="clear:both"></div>
    </div>
    <div class="nav">
        <ul>
            <li class="selectedpage">
                <a class="a-home" href="index.html" >
                    <span>Home</span>
                </a>
            </li>
            <li>
                <a class="a-classes " href="classes.html">
                    <span>All Classes</span>
                </a>
            </li>
            <li>
                <a class="a-home " href="gcf_modules.html">
                    <span>Modules</span>
                </a>
            </li>
            <li>
                <a class="a-home " href="gcf_guides_and_videos.html">
                    <span>Guides & Videos</span>
                </a>
            </li>
            <li>
                <a class="a-home " href="gcf_tools_and_inbuilt_components.html">
                    <span>Tools & Components</span>
                </a>
            </li>
        </ul>
    </div>
    <div id="main-content">
        <div class="inside">
        <div>
<!-- Generated by Doxygen 1.8.16 -->
</div><!-- top -->
<div class="PageDoc"><div class="header">
  <div class="headertitle">
<div class="title">GCF Investigator </div>  </div>
</div><!--header-->
<div class="contents">
<div class="toc"><h3>Table of Contents</h3>
<ul><li class="level1"><a href="#gcf_investigator_tutorial">Tutorial</a><ul><li class="level2"><a href="#gcf_investigator_tutorial_0">Implementing the AUT</a></li>
<li class="level2"><a href="#gcf_investigator_tutorial_1">Creating a UI test script for the AUT</a></li>
<li class="level2"><a href="#gcf_investigator_tutorial_2">Adding validation checks</a></li>
<li class="level2"><a href="#gcf_investigator_tutorial_3">Running the test script</a></li>
</ul>
</li>
<li class="level1"><a href="#gcf_investigator_example">Example - Calculator Application</a><ul><li class="level2"><a href="#gcf_investigator_example_1">Record test script</a></li>
<li class="level2"><a href="#gcf_investigator_example_2">Insert validation code</a></li>
<li class="level2"><a href="#gcf_investigator_example_3">Run the test script and validate the application</a></li>
</ul>
</li>
<li class="level1"><a href="#gcf_investigator_agent">GCF Investigator - Agent</a><ul><li class="level2"><a href="#gcf_investigator_agent_1">Command line parameters</a></li>
<li class="level2"><a href="#gcf_investigator_agent_2">Script environment</a><ul><li class="level3"><a href="#gcf_investigator_agent_21">log(message)</a></li>
<li class="level3"><a href="#gcf_investigator_agent_22">fail(message)</a></li>
<li class="level3"><a href="#gcf_investigator_agent_23">object(path)</a></li>
<li class="level3"><a href="#gcf_investigator_agent_24">interface(name)</a></li>
<li class="level3"><a href="#gcf_investigator_agent_25">wait(milliseconds)</a></li>
<li class="level3"><a href="#gcf_investigator_agent_26">waitForSignal(object,signal,timeout)</a></li>
<li class="level3"><a href="#gcf_investigator_agent_27">waitForPropertyChange(object,property,timeout)</a></li>
<li class="level3"><a href="#gcf_investigator_agent_28">compare(v1,v2,msg)</a></li>
<li class="level3"><a href="#gcf_investigator_agent_29">verify(condition,msg)</a></li>
<li class="level3"><a href="#gcf_investigator_agent_210">createSignalSpy(object,signal)</a></li>
</ul>
</li>
</ul>
</li>
<li class="level1"><a href="#gcf_investigator_script">GCF Investigator - Test Script</a></li>
<li class="level1"><a href="#gcf_investigator_recorder">GCF Investigator - Recorder</a></li>
<li class="level1"><a href="#gcf_investigator_runner">GCF Investigator - Runner</a></li>
</ul>
</div>
<div class="textblock"><p> 
<div style="border: 1px solid black; padding: 20px; margin: 20px; font-size: 1.25em; width: 50%;">
Please ensure that you explicitly install QtScript module while installing Qt 5.x on your
computer. Without QtScript module, GCF Investigator will __NOT__ work. If you do not
have QtScript installed, then GCF compilation will fail!!!
</div>
</p>
<p>GCF Investigator is a tool-set that allows you to record, edit and play automated test scripts for GCF applications. Investigator is used only for creating UI test cases. For all other kinds, you can use QtTestLib or any other testing tool of your choice. The tool-set consists of the following</p>
<ul>
<li><b>Investigator</b> <b>Agent</b> <b>Component</b> - this component is loaded into an application to either record or run a test case. </li>
<li><b>Recorder</b> - this program loads the agent component into an application and triggers record of a test case. </li>
<li><b>Runner</b> - this program loads the agent component into an application and triggers running of a test case.</li>
</ul>
<p>This page explains what Investigator can do and what it cannot do with the help of tutorials and examples.</p>
<h1><a class="anchor" id="gcf_investigator_tutorial"></a>
Tutorial</h1>
<p>Consider a simple <a class="el" href="group__gcf__gui.html">GCFGui3</a> application that when launched shows a window as follows.</p>
<div class="image">
<img src="tutorial-window.png" alt=""/>
</div>
<p>In this application we have connected signals and slots between the sliders and dial in such a way that their values are always configured to be in sync. For instance if the value of dial is changed, then the values of the slider also change. The form itself is designed in Qt Designer. The application simply loads the form and shows it.</p>
<p>Applications that are being tested using GCF Investigator are called AUT (or Application Under Test). In the next section you will see how to structure code of your AUT.</p>
<h2><a class="anchor" id="gcf_investigator_tutorial_0"></a>
Implementing the AUT</h2>
<p>Shown below is the code of an <b>AUT</b> that would load the form as described before.</p>
<div class="fragment"><div class="line"><span class="preprocessor">#include &lt;GCF3/GuiApplication&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;GCF3/GuiComponent&gt;</span></div>
<div class="line"><span class="preprocessor">#include &quot;ui_Form.h&quot;</span></div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv)</div>
<div class="line">{</div>
<div class="line">    <a class="code" href="class_g_c_f_1_1_gui_application.html">GCF::GuiApplication</a> a(argc, argv);</div>
<div class="line"> </div>
<div class="line">    QWidget *formWindow = <span class="keyword">new</span> QWidget;</div>
<div class="line">    Ui::Form ui;</div>
<div class="line">    ui.setupUi(formWindow);</div>
<div class="line">    formWindow-&gt;show();</div>
<div class="line"> </div>
<div class="line">    <a class="code" href="class_g_c_f_1_1_component.html">GCF::Component</a> *formComponent = <span class="keyword">new</span> <a class="code" href="class_g_c_f_1_1_component.html">GCF::Component</a>;</div>
<div class="line">    formComponent-&gt;<a class="code" href="class_g_c_f_1_1_component.html#ac8791368cb9615392e6c9c2d380034f1">addContentObject</a>(<span class="stringliteral">&quot;formWindow&quot;</span>, formWindow);</div>
<div class="line"> </div>
<div class="line">    <span class="keywordflow">return</span> a.processArgumentsAndExec();</div>
<div class="line">}</div>
</div><!-- fragment --><p>The following paragraphs explain each aspect of the <code>main()</code> function implementation.</p>
<p>You start by creating an instance of <a class="el" href="class_g_c_f_1_1_gui_application.html">GCF::GuiApplication</a> as follows.</p>
<div class="fragment"><div class="line"><span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv)</div>
<div class="line">{</div>
<div class="line">    <a class="code" href="class_g_c_f_1_1_gui_application.html">GCF::GuiApplication</a> a(argc, argv);</div>
</div><!-- fragment --><p>Then you create a <code>formWindow</code> and show it. It is important to create <code>formWindow</code> on the heap; because later on you will be adding the form window to a component as a content object. GCF deletes all content objects when the component is unloaded (which happens when the application is shuting down). We dont want GCF to attempt deleting an object on the stack!</p>
<div class="fragment"><div class="line">QWidget *formWindow = <span class="keyword">new</span> QWidget;</div>
<div class="line">Ui::Form ui;</div>
<div class="line">ui.setupUi(formWindow);</div>
<div class="line">formWindow-&gt;show();</div>
</div><!-- fragment --><p>Next you create a <a class="el" href="class_g_c_f_1_1_component.html">GCF::Component</a> instance and add the <code>formWindow</code> as a content object to it. This part is important because GCF Investigator expects to find root windows in the <a class="el" href="class_g_c_f_1_1_component.html#gcf_component_objectTree">object-tree of the application</a>.</p>
<div class="fragment"><div class="line"><a class="code" href="class_g_c_f_1_1_component.html">GCF::Component</a> *formComponent = <span class="keyword">new</span> <a class="code" href="class_g_c_f_1_1_component.html">GCF::Component</a>;</div>
<div class="line">formComponent-&gt;<a class="code" href="class_g_c_f_1_1_component.html#a06e3573f06292a5211b81201ced61deb">load</a>();</div>
<div class="line">formComponent-&gt;<a class="code" href="class_g_c_f_1_1_component.html#ac8791368cb9615392e6c9c2d380034f1">addContentObject</a>(<span class="stringliteral">&quot;formWindow&quot;</span>, formWindow);</div>
</div><!-- fragment --><p>Finally, you should make use of the <code>processArgumentsAndExec()</code> function to run the event loop of your application. This part is done to ensure that the <code>&ndash;loadComponents</code> command-line argument is parsed and processed. It is through this command-line argument that the <a class="el" href="gcf_investigator.html#gcf_investigator_recorder">Recorder</a> and <a class="el" href="gcf_investigator.html#gcf_investigator_runner">Runner</a> tools reqest loading of the <a class="el" href="gcf_investigator.html#gcf_investigator_agent">Agent</a> component into your AUT. <b>NOTE:</b> if <code>processArgumentsAndExec()</code> is not used - then you will not be able to record or run test case scripts in your application.</p>
<div class="fragment"><div class="line">    <span class="keywordflow">return</span> a.processArgumentsAndExec();</div>
<div class="line">}</div>
</div><!-- fragment --><h2><a class="anchor" id="gcf_investigator_tutorial_1"></a>
Creating a UI test script for the AUT</h2>
<p>To create a AUT test script, launch the <a class="el" href="gcf_investigator.html#gcf_investigator_recorder">Recorder</a> tool from the command prompt as follows.</p>
<pre class="fragment">$ cd /path/to/aut-binary
$ $GCFDIR/Investigator/Recorder ./AUT TestScript1.js
</pre><dl class="section note"><dt>Note</dt><dd>Here <code>$GCFDIR</code> refers to an environment variable that points to the <code>Binary</code> folder of the directory where you have compiled GCF3. </dd>
<dd>
Here <code>AUT</code> is the name of the application executable file.</dd></dl>
<p>When you launch <a class="el" href="gcf_investigator.html#gcf_investigator_recorder">Recorder</a>, as described above, the following happens</p>
<ul>
<li><a class="el" href="gcf_investigator.html#gcf_investigator_recorder">Recorder</a> will inject <a class="el" href="gcf_investigator.html#gcf_investigator_agent">Agent</a> component into the AUT and trigger its loading. </li>
<li><a class="el" href="gcf_investigator.html#gcf_investigator_recorder">Recorder</a> will send a request for recording of all user actions on the AUT into a script called <code>TestScript1.js</code> </li>
</ul>
<p>Suppose you click on the dial in the AUT and notice its value changing. You then close the application and open <code>TestScript1.js</code> in a text editor. You will notice the following code</p>
<div class="fragment"><div class="line"><span class="keyword">function</span> test_function() {</div>
<div class="line">    wait(750)</div>
<div class="line"> </div>
<div class="line">    var dial = <span class="keywordtype">object</span>(&quot;Application.GCF_Component.formWindow/dial&quot;)</div>
<div class="line">    dial.mouseClickAtPos(144, 31, Qt.LeftButton, Qt.NoModifier)</div>
<div class="line">}</div>
</div><!-- fragment --><dl class="section note"><dt>Note</dt><dd>The code generated on your computer may be slightly different.</dd></dl>
<p>Later, you can read more about <a class="el" href="gcf_investigator.html#gcf_investigator_script">test script syntax</a> and the <a class="el" href="gcf_investigator.html#gcf_investigator_agent_2">environment</a> in which the scripts are run. But at this point it is enough to know</p>
<ul>
<li><code>test_xxx()</code> functions in the test script are called one after the other, when the test script is run. </li>
<li>the <code>object()</code> method allows you to reference named objects in the application </li>
<li>you can trigger events by using methods like <code>mouseClickAtPos()</code> </li>
<li>you can introduce spin waits using the <code>wait()</code> method</li>
</ul>
<h2><a class="anchor" id="gcf_investigator_tutorial_2"></a>
Adding validation checks</h2>
<p>Now suppose that you want to include validation checks in the script. Lets say you wanted to verify ane ensure that values of dial, horizontal and vertical sliders are in sync. You would modify the test script code as follows</p>
<div class="fragment"><div class="line"><span class="keyword">function</span> test_function() {</div>
<div class="line">    wait(750)</div>
<div class="line"> </div>
<div class="line">    var dial = <span class="keywordtype">object</span>(&quot;Application.GCF_Component.formWindow/dial&quot;)</div>
<div class="line">    dial.mouseClickAtPos(144, 31, Qt.LeftButton, Qt.NoModifier)</div>
<div class="line"> </div>
<div class="line">    log(&quot;Dial value is now: &quot; + dial.value)</div>
<div class="line"> </div>
<div class="line">    var verticalScrollBar = <span class="keywordtype">object</span>(&quot;Application.GCF_Component.formWindow/verticalScrollBar&quot;)</div>
<div class="line">    var horizontalScrollBar = <span class="keywordtype">object</span>(&quot;Application.GCF_Component.formWindow/horizontalScrollBar&quot;)</div>
<div class="line"> </div>
<div class="line">    verify(dial.value === horizontalScrollBar.value)</div>
<div class="line">    verify(dial.value === verticalScrollBar.value)</div>
<div class="line">}</div>
</div><!-- fragment --><p>The <code>verify()</code> method passed the test function if the condition passed in it was true. It fails the test function and reports it otherwise. You can learn more about these functions in a <a class="el" href="gcf_investigator.html#gcf_investigator_script">later section</a>.</p>
<h2><a class="anchor" id="gcf_investigator_tutorial_3"></a>
Running the test script</h2>
<p>You can now run the test script using the <a class="el" href="gcf_investigator.html#gcf_investigator_runner">Runner</a> tool as follows</p>
<pre class="fragment">$ cd /path/to/aut-binary
$ $GCFDIR/Investigator/Runner ./Tutorial TestScript1.js
********* Start testing of Tutorial *********
Using GCF 3.0.0 on Qt 5.1.1
Scheduling test-script 'TestScript1.js' for execution after 0 seconds
Running script 'TestScript1.js'
test_function {
    Dial value is now: 45
}
SUCCESS:
********* Finished testing of Tutorial *********
</pre><p>When you launched the <a class="el" href="gcf_investigator.html#gcf_investigator_runner">Runner</a> tool, as described above, the following happend</p>
<ul>
<li><a class="el" href="gcf_investigator.html#gcf_investigator_runner">Runner</a> injected <a class="el" href="gcf_investigator.html#gcf_investigator_agent">Agent</a> component into the AUT and triggered its loading. </li>
<li><a class="el" href="gcf_investigator.html#gcf_investigator_runner">Runner</a> then requested for <code>TestScript1.js</code> to be loaded and executed. </li>
<li><a class="el" href="gcf_investigator.html#gcf_investigator_agent">Agent</a> component, which was loaded into the AUT, processes the <code>TestScript1.js</code> file and exectes all <code>test_xxx()</code> functions. </li>
<li>It then dumps the test results to console</li>
</ul>
<h1><a class="anchor" id="gcf_investigator_example"></a>
Example - Calculator Application</h1>
<p>Qt comes with a standard inbuilt <code>'calculator'</code> example. Lets alter the code of that example a little bit and see how we can use GCF Investigator to test it. Start Qt Creator and open the 'Calculator Example'.</p>
<div class="image">
<img src="qt-calculator.png" alt=""/>
</div>
<p>After opening the example, compile and execute it. Just to make sure that it works.</p>
<div class="image">
<img src="qt-calculator-run.png" alt=""/>
</div>
<p>You can now start GCFying the application by altering the project file (<code>calculator.pro</code>) as follows</p>
<div class="fragment"><div class="line">QT += script widgets uitools</div>
<div class="line">RESOURCES += calculator.qrc</div>
<div class="line">SOURCES += main.cpp</div>
<div class="line">CONFIG -= app_bundle</div>
<div class="line">CONFIG += GCFGui3 # to include GCF<span class="stringliteral">&#39;s Gui module</span></div>
<div class="line"><span class="stringliteral"></span> </div>
<div class="line"><span class="stringliteral">qtHaveModule(scripttools): QT += scripttools</span></div>
</div><!-- fragment --><p>Next, alter the <code>main.cpp</code> file as follows</p>
<div class="fragment"><div class="line"><span class="preprocessor">#include &lt;QApplication&gt;</span></div>
<div class="line">....</div>
<div class="line">....</div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;GCF3/GuiApplication&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;GCF3/Component&gt;</span></div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv)</div>
<div class="line">{</div>
<div class="line">    Q_INIT_RESOURCE(calculator);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Instead of QApplication use, GCF::GuiApplication</span></div>
<div class="line">    <a class="code" href="class_g_c_f_1_1_gui_application.html">GCF::GuiApplication</a> app(argc, argv);</div>
<div class="line"> </div>
<div class="line">    .....</div>
<div class="line">    .....</div>
<div class="line">    .....</div>
<div class="line"> </div>
<div class="line">    ui-&gt;show();</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Create a UI component and add ui as content object into it</span></div>
<div class="line">    <a class="code" href="class_g_c_f_1_1_component.html">GCF::Component</a> *uiComp = <span class="keyword">new</span> <a class="code" href="class_g_c_f_1_1_component.html">GCF::Component</a>;</div>
<div class="line">    uiComp-&gt;<a class="code" href="class_g_c_f_1_1_component.html#a06e3573f06292a5211b81201ced61deb">load</a>();</div>
<div class="line">    uiComp-&gt;<a class="code" href="class_g_c_f_1_1_component.html#ac8791368cb9615392e6c9c2d380034f1">addContentObject</a>(<span class="stringliteral">&quot;ui&quot;</span>, ui);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// call processArgumentsAndExec() instead of exec</span></div>
<div class="line">    <span class="keywordflow">return</span> app.processArgumentsAndExec();</div>
<div class="line">}</div>
</div><!-- fragment --><p>Now compile and execute the application. Just to make sure that it works after all the modifications.</p>
<div class="image">
<img src="gcf-calculator-run.png" alt=""/>
</div>
<p>What you have accomplished with all these changes is that you have made the calculator example <b>testable</b> with <b>Investigator</b>.</p>
<h2><a class="anchor" id="gcf_investigator_example_1"></a>
Record test script</h2>
<p>You can launch the <a class="el" href="gcf_investigator.html#gcf_investigator_recorder">Recorder</a> tool to start recording all user actions into a test case.</p>
<pre class="fragment">$ cd /path/to/calculator-binary
$ $GCFDIR/Investigator/Recorder ./calculator TestScript1.js
</pre><p>Suppose that you wanted to test whether the <code>SQRT</code> button on the calculator works properly or not. You could the <code>calculator</code> program and "feed" user actions to compute the square-root of say 198; and have <a class="el" href="gcf_investigator.html#gcf_investigator_recorder">Recorder</a> capture all the user actions into a script. When you open <code>TestScript1.js</code>; you will find the following auto-generated code</p>
<div class="fragment"><div class="line"><span class="keyword">function</span> test_function() {</div>
<div class="line">    wait(3000)</div>
<div class="line"> </div>
<div class="line">    var changeSignButton = <span class="keywordtype">object</span>(&quot;Application.GCF_Component.ui/changeSignButton&quot;)</div>
<div class="line">    var calculator = <span class="keywordtype">object</span>(&quot;Application.GCF_Component.ui&quot;)</div>
<div class="line">    var pointButton = <span class="keywordtype">object</span>(&quot;Application.GCF_Component.ui/pointButton&quot;)</div>
<div class="line">    var twoButton = <span class="keywordtype">object</span>(&quot;Application.GCF_Component.ui/twoButton&quot;)</div>
<div class="line">    var oneButton = <span class="keywordtype">object</span>(&quot;Application.GCF_Component.ui/oneButton&quot;)</div>
<div class="line">    oneButton.mouseClickAtPos(23, 14, Qt.LeftButton, Qt.NoModifier)</div>
<div class="line"> </div>
<div class="line">    oneButton.mousePressAtPos(23, 14, Qt.LeftButton, Qt.NoModifier)</div>
<div class="line">    oneButton.mouseMove(24, 10)</div>
<div class="line">    var fiveButton = <span class="keywordtype">object</span>(&quot;Application.GCF_Component.ui/fiveButton&quot;)</div>
<div class="line">    var nineButton = <span class="keywordtype">object</span>(&quot;Application.GCF_Component.ui/nineButton&quot;)</div>
<div class="line">    nineButton.mouseClickAtPos(13, 22, Qt.LeftButton, Qt.NoModifier)</div>
<div class="line"> </div>
<div class="line">    nineButton.mousePressAtPos(13, 22, Qt.LeftButton, Qt.NoModifier)</div>
<div class="line">    nineButton.mouseMove(12, 22)</div>
<div class="line">    var eightButton = <span class="keywordtype">object</span>(&quot;Application.GCF_Component.ui/eightButton&quot;)</div>
<div class="line">    eightButton.mouseClickAtPos(30, 22, Qt.LeftButton, Qt.NoModifier)</div>
<div class="line"> </div>
<div class="line">    eightButton.mousePressAtPos(30, 22, Qt.LeftButton, Qt.NoModifier)</div>
<div class="line">    eightButton.mouseMove(32, 22)</div>
<div class="line">    var divisionButton = <span class="keywordtype">object</span>(&quot;Application.GCF_Component.ui/divisionButton&quot;)</div>
<div class="line">    var squareRootButton = <span class="keywordtype">object</span>(&quot;Application.GCF_Component.ui/squareRootButton&quot;)</div>
<div class="line">    squareRootButton.mouseClickAtPos(29, 22, Qt.LeftButton, Qt.NoModifier)</div>
<div class="line"> </div>
<div class="line">    squareRootButton.mousePressAtPos(29, 22, Qt.LeftButton, Qt.NoModifier)</div>
<div class="line">    squareRootButton.mouseMove(29, 21)</div>
<div class="line">    var clearAllButton = <span class="keywordtype">object</span>(&quot;Application.GCF_Component.ui/clearAllButton&quot;)</div>
<div class="line">    var display = <span class="keywordtype">object</span>(&quot;Application.GCF_Component.ui/display&quot;)</div>
<div class="line">    display.mouseClickAtPos(219, 20, Qt.LeftButton, Qt.NoModifier)</div>
<div class="line"> </div>
<div class="line">    wait(750)</div>
<div class="line"> </div>
<div class="line">    display.mousePressAtPos(219, 20, Qt.LeftButton, Qt.NoModifier)</div>
<div class="line">    display.mouseMove(218, 20)</div>
<div class="line">}</div>
</div><!-- fragment --><h2><a class="anchor" id="gcf_investigator_example_2"></a>
Insert validation code</h2>
<p>At the moment the <a class="el" href="gcf_investigator.html#gcf_investigator_recorder">Recorder</a> doesnt capture user actions in a optimized way. So some edits are required. Shown below is a modified (and shorter) version of the same code.</p>
<div class="fragment"><div class="line"><span class="keyword">function</span> test_sqrt() {</div>
<div class="line">    wait(750)</div>
<div class="line"> </div>
<div class="line">    var oneButton = <span class="keywordtype">object</span>(&quot;Application.GCF_Component.ui/oneButton&quot;)</div>
<div class="line">    oneButton.mouseClick(Qt.LeftButton, Qt.NoModifier)</div>
<div class="line"> </div>
<div class="line">    var nineButton = <span class="keywordtype">object</span>(&quot;Application.GCF_Component.ui/nineButton&quot;)</div>
<div class="line">    nineButton.mouseClick(Qt.LeftButton, Qt.NoModifier)</div>
<div class="line"> </div>
<div class="line">    var eightButton = <span class="keywordtype">object</span>(&quot;Application.GCF_Component.ui/eightButton&quot;)</div>
<div class="line">    eightButton.mouseClick(Qt.LeftButton, Qt.NoModifier)</div>
<div class="line"> </div>
<div class="line">    var display = <span class="keywordtype">object</span>(&quot;Application.GCF_Component.ui/display&quot;)</div>
<div class="line">    verify(display.text === &quot;198&quot;) <span class="comment">// validation code</span></div>
<div class="line"> </div>
<div class="line">    var squareRootButton = <span class="keywordtype">object</span>(&quot;Application.GCF_Component.ui/squareRootButton&quot;)</div>
<div class="line">    squareRootButton.mouseClick(Qt.LeftButton, Qt.NoModifier)</div>
<div class="line"> </div>
<div class="line">    var sqrtValue = 14.0712472795</div>
<div class="line"> </div>
<div class="line">    verify(display.text == sqrtValue, &quot;Incorrect square root of 198&quot;)  <span class="comment">// validation code</span></div>
<div class="line">}</div>
</div><!-- fragment --><p>The above code is now easier to follow. It simulates mouse click on 1, 9 and 8 buttons. Ensures that the display is showing "198". Then it sumulates mouse click on the square root button and verifies that the result shown in the square-root is appropriate.</p>
<h2><a class="anchor" id="gcf_investigator_example_3"></a>
Run the test script and validate the application</h2>
<p>You can now make use of <a class="el" href="gcf_investigator.html#gcf_investigator_runner">Runner</a> to run the test script and check if the application passes the test.</p>
<pre class="fragment">$ cd /path/to/calculator-binary
$ $GCFDIR/Investigator/Runner ./Calculator TestScript1.js
********* Start testing of Calculator *********
Using GCF 3.0.0 on Qt 5.1.1
Scheduling test-script 'TestScript1.js' for execution after 0 seconds
Running script 'TestScript1.js'
test_function {
    FAILED at line 21: Incorrect square root of 198
}
FAILURE: 1 of 1 test case(s) failed
********* Finished testing of Calculator *********
</pre><p>The test case failed because the calculator uses <code>Math.sqrt()</code> javascript function to evaluate square root of 198. And that function returns 14.071247279470288; a value more precise than 14.0712472795. You can either perform a verification with error tolerance or compare the result directly against <code>Math.sqrt(198)</code>. The following code snippet shows how to do the latter</p>
<div class="fragment"><div class="line"><span class="keyword">function</span> test_sqrt() {</div>
<div class="line">    ....</div>
<div class="line">    ....</div>
<div class="line">    var sqrtValue = Math.sqrt(198)</div>
<div class="line">    verify(display.text == sqrtValue, <span class="stringliteral">&quot;Incorrect square root of 198&quot;</span>)  <span class="comment">// validation code</span></div>
<div class="line">}</div>
</div><!-- fragment --><p>Now use <a class="el" href="gcf_investigator.html#gcf_investigator_runner">Runner</a> to run the test script and check if the application passes the test.</p>
<pre class="fragment">$ cd /path/to/calculator-binary
$ $GCFDIR/Investigator/Runner ./Calculator TestScript1.js
********* Start testing of Calculator *********
Using GCF 3.0.0 on Qt 5.1.1
Scheduling test-script 'TestScript1.js' for execution after 0 seconds
Running script 'TestScript1.js'
test_function {
}
SUCCESS:
********* Finished testing of Calculator *********
</pre><p>Sure enough it does!</p>
<h1><a class="anchor" id="gcf_investigator_agent"></a>
GCF Investigator - Agent</h1>
<p><b>Agent</b> is a GCF component that can be loaded into any GCF application to either record user actions into a script or run a test script and print results. It is a light-weight component that makes a AUT testable.</p>
<p>The <b>Agent</b> component can be loaded explicitly by the AUT as follows </p><div class="fragment"><div class="line">gAppService-&gt;loadComponent(<span class="stringliteral">&quot;Investigator/Agent&quot;</span>);</div>
</div><!-- fragment --><p>But that is a non-standard way to load the <b>Agent</b> component. A better way is to write your AUT such that it makes use of the <a class="el" href="class_g_c_f_1_1_application.html#ab9501117acd2cad8673c7a35f6b3b793">GCF::Application::processArgumentsAndExec()</a> function to trigger the event loop. You can then inject the <b>Agent</b> component into the application by making use of the <code>&ndash;loadComponents</code> commandline argument.</p>
<pre class="fragment">$ cd /path/to/aut
$ ./aut --loadComponents:Investigator/Agent
</pre><h2><a class="anchor" id="gcf_investigator_agent_1"></a>
Command line parameters</h2>
<p>When you load the <b>Agent</b> component into a AUT, it looks for certain command line arguments passed to the AUT. If none of the command line arguments are found, then the <b>Agent</b> will trigger AUT to quit immediately.</p>
<p> 
<table border="1" cellpadding="4" cellspacing="0" style="width: 80%;">
<tbody>
<tr>
    <td><b>Parameter</b></td>
    <td><b>Description</b></td>
</tr>
<tr>
    <td><pre>--record</pre></td>
    <td>
    <p>Requests <b>Agent </b>to record user actions into a test script. The script will
    be dumped on standard output when the AUT is closed, unless the --outputFile
    parameter is used. Example:</p>

    <pre>$ ./AUT --loadComponents:Investigator/Agent --record</pre>
    </td>
</tr>
<tr>
    <td><pre>--outputFile:&lt;output-file-name&gt;</pre></td>
    <td>
    <p>Requests <b>Agent</b> to dump the recorded test script into a file. Example:</p>

    <pre>$ ./AUT --loadComponents:Investigator/Agent --record --outputFile:/path/to/output-file.js</pre>
    </td>
</tr>
<tr>
    <td><pre>--testScript:&lt;script-file-name&gt;</pre></td>
    <td>
    <p>Requests <b>Agent</b> to process run the specified test script on the AUT. Example:</p>

    <pre>$ ./AUT --loadComponents:Investigator/Agent --testScript:/path/to/test-script.js</pre>
    </td>
</tr>
<tr>
    <td><pre>--testStartDelay:&lt;n&gt;</pre></td>
    <td>
    <p>Requests <b>Agent</b> to start processing the test script after <b><i>n</i></b> seconds.
    By default the test script is run immediately. Example:</p>

    <pre>$ ./AUT --loadComponents:Investigator/Agent --testScript:/path/to/test-script.js --testStartDelay:10</pre>
    </td>
</tr>
</tbody>
</table>
</p>
<h2><a class="anchor" id="gcf_investigator_agent_2"></a>
Script environment</h2>
<p>When <b>Agent</b> is used to run a test script, it creates an environment inside of which the script files are loaded and executed. This environment offers all enumerations defined in the Qt namespace (example: <code>Qt.LeftButton</code>, <code>Qt.Key_A</code> etc..). It also offers the following functions</p>
<ul>
<li><a class="el" href="gcf_investigator.html#gcf_investigator_agent_21">log(message)</a> </li>
<li><a class="el" href="gcf_investigator.html#gcf_investigator_agent_22">fail(message)</a> </li>
<li><a class="el" href="gcf_investigator.html#gcf_investigator_agent_23">object(path)</a> </li>
<li><a class="el" href="gcf_investigator.html#gcf_investigator_agent_24">interface(name)</a> </li>
<li><a class="el" href="gcf_investigator.html#gcf_investigator_agent_25">wait(milliseconds)</a> </li>
<li><a class="el" href="gcf_investigator.html#gcf_investigator_agent_26">waitForSignal(object,signal,timeout)</a> </li>
<li><a class="el" href="gcf_investigator.html#gcf_investigator_agent_27">waitForPropertyChange(object,property,timeout)</a> </li>
<li><a class="el" href="gcf_investigator.html#gcf_investigator_agent_28">compare(v1,v2,msg)</a> </li>
<li><a class="el" href="gcf_investigator.html#gcf_investigator_agent_29">verify(condition,msg)</a> </li>
<li><a class="el" href="gcf_investigator.html#gcf_investigator_agent_210">createSignalSpy(object,signal)</a></li>
</ul>
<h3><a class="anchor" id="gcf_investigator_agent_21"></a>
log(message)</h3>
<p>This function can be used to log anything into the output of the test. The log will show up within the context created for the test function that is currently being run. Example:</p>
<div class="fragment"><div class="line"><span class="keyword">function</span> test_function() {</div>
<div class="line">    log(<span class="stringliteral">&quot;this is my log message&quot;</span>)</div>
<div class="line">}</div>
</div><!-- fragment --><p>When the above test script is executed, you would get the following result</p>
<pre class="fragment">$ cd /path/to/calculator-binary
$ ./Calculator --loadComponents:Investigator/Agent --testScript:script.js
********* Start testing of calculator *********
Using GCF 3.0.0 on Qt 5.1.1
Scheduling test-script 'script.js' for execution after 0 seconds
Running script 'script.js'
test_function {
    this is my log message
}
SUCCESS:
********* Finished testing of calculator *********
</pre><h3><a class="anchor" id="gcf_investigator_agent_22"></a>
fail(message)</h3>
<p>This function can be used to log a message and immediately mark the current test function as failed. The <code>fail()</code> function never returns to the caller. It immediately quits the test_function() and causes <b>Agent</b> to move on to the next test function. Example:</p>
<div class="fragment"><div class="line"><span class="keyword">function</span> test_function() {</div>
<div class="line">    log(<span class="stringliteral">&quot;log message before fail&quot;</span>)</div>
<div class="line">    fail(&quot;fail message&quot;)</div>
<div class="line">    log(&quot;log message after fail&quot;)</div>
<div class="line">}</div>
</div><!-- fragment --><p>When the above test script is executed, you would get the following result</p>
<pre class="fragment">$ cd /path/to/calculator-binary
$ ./Calculator --loadComponents:Investigator/Agent --testScript:script.js
********* Start testing of calculator *********
Using GCF 3.0.0 on Qt 5.1.1
Scheduling test-script 'script.js' for execution after 0 seconds
Running script 'script.js'
test_function {
    log message before fail
    FAILED at line 3: fail message
}
FAILURE: 1 of 1 test case(s) failed
********* Finished testing of calculator *********
</pre><h3><a class="anchor" id="gcf_investigator_agent_23"></a>
object(path)</h3>
<p>This function is used to search for <code>QObject</code> instances in your application and return a reference to them for use in your test scripts. The function accepts as parameter the path of the object being searched. The path is a slash '/' seperated set of names that dig into the trees of objects in the AUT.</p>
<ul>
<li>The first component of path is complete name of an object in the AUT's <a class="el" href="class_g_c_f_1_1_application_services.html#a22657bd136cbf7a285cf0b273a40963a">GCF::ApplicationServices::objectTree()</a>. Example: <code>"Application.Component.Object"</code>. </li>
<li>From then on each component of the path could be<ul>
<li>Name of a child object. Example: <code>"Application.Component.Object/childName/grandChildName"</code> </li>
<li>Indexed class-name of the child object. Example: <code>"Application.Component.Object/QClassName[1]/AnotherClass[2]"</code> </li>
<li>Mixture of the above. Example: <code>"Application.Component.Object/childName/QClassName[1]/grandChildName"</code> </li>
</ul>
</li>
<li>Special names for special child objects<ul>
<li>If the path of an object leads to a <code>QAbstractScrollArea</code> (or its subclasses), then<ul>
<li><code>viewport</code> will fetch its viewport widget. Example <code>"Application.C.O/QTreeView[0]/viewport"</code> </li>
<li><code>horizontalscrollbar</code> will fetch the horizontal scroll-bar of the scroll area</li>
<li><code>verticalscrollbar</code> will fetch the vertical scroll-bar of the scroll area</li>
</ul>
</li>
<li>If the path leads to a <code>QAbstractItemView</code> (or its subclasses), then<ul>
<li><code>viewport</code>, <code>horizontalsrollbar</code>, <code>verticalscrollbar</code> will work as it would for a <code>QAbstractScrollArea</code> </li>
<li><code>model</code> will fetch the view's model</li>
<li><code>delegate</code> will fetch the view's delegate</li>
<li><code>selectionmodel</code> will fetch the selection model of the view</li>
<li><code>horizontalheader</code> will fetch the view's horizontal header</li>
<li><code>verticalheader</code> will fetch the view's vertical header</li>
</ul>
</li>
<li>If the path leads to a <code>QGraphicsView</code> (or its subclasses), then<ul>
<li><code>viewport</code>, <code>horizontalsrollbar</code>, <code>verticalscrollbar</code> will work as it would for a <code>QAbstractScrollArea</code> </li>
<li><code>scene</code> would fetch the view's scene</li>
<li>names of <code>QGraphicsObject</code> items in the scene can be used to fetch items in the scene</li>
</ul>
</li>
<li>If the path leads to a <code>QQuickView</code> (or its subclasses), then<ul>
<li><code>engine</code> will return pointer to the <code>QQmlEngine</code> used by the <code>QQuickView</code> </li>
<li>names of context properties (set using <code>QQmlEngine::rootContext()-&gt;setContextProperty(...)</code>) can be used to fetch object corresponding to the context property.</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>The <code>object(string)</code> function returns a object variable. Depending on the type of object returned certain functions and properties will be made available. For example if the returned object is a <code>QWidget</code> then you can access <code>mousePress()</code>, <code>mouseClick()</code>, <code>mouseRelease()</code> etc. The following table lists out all such object-type specific functions and properties.</p>
<p> 
<table border="1" cellpadding="4" cellspacing="0" style="width: 80%;">
<tbody>
<tr>
    <td><b>Object type</b></td>
    <td><b>Functions</b></td>
</tr>
<tr>
    <td><code>QObject</code></td>
    <td>
        <ul>
            <li><code>parent</code>: Returns parent of this object</li>
            <li><code>object(string)</code>: Returns a child object referenced by the
            string path parameter. Path parameter convention is same as above.</li>
        </ul>
    </td>
</tr>
<tr>
    <td><code>QWidget, QWindow</code></td>
    <td>
        <ul>
            <li>Inherits properties and functions from <code>QObject</code></li>
            <li><code>keyboardFocus</code>: true if the widget (or window) has keyboard focus. False otherwise</li>
            <li><code>setGeometry(x,y,width,height)</code>: Sets geometry of the widget.</li>
            <li><code>resize(width,height)</code>: Resizes the widget.</li>
            <li><code>mousePress(button,modifiers)</code>: Simulates mouse press on the widget.
            button is value from Qt.MouseButton enumeration. And modifiers is a value from
            is Qt.KeyboardModifiers enumeration.</li>
            <li><code>mousePressAtPos(x,y,button,modifiers)</code>: Simulates mouse press on the
            widget at a particular position.</li>
            <li><code>mouseRelease(button,modifiers)</code>: Simulates mouse release on the widget.
            button is value from Qt.MouseButton enumeration. And modifiers is a value from
            is Qt.KeyboardModifiers enumeration.</li>
            <li><code>mouseReleaseAtPos(x,y,button,modifiers)</code>: Simulates mouse release on the
            widget at a particular position.</li>
            <li><code>mouseMove(x,y)</code>: Simulates mouse move on the widget at a particular position.</li>
            <li><code>mouseClick(button,modifiers)</code>: Simulates mouse click on the widget</li>
            <li><code>mouseClickAtPos(x,y,button,modifiers)</code>: Simulates mouse click on the widget
            at a specific position</li>
            <li><code>mouseDClick(button,modifiers)</code>: Simulates mouse double click on the widget</li>
            <li><code>mouseDClickAtPos(x,y,button,modifiers)</code>: Simulates mouse double click on the widget
            at a specific position</li>
            <li><code>keyPress(modifiers,key)</code>: Simulates key press on the widget. The key parameter
            can be a value from Qt.Key enumeration.</li>
            <li><code>keyRelease(modifiers,key)</code>: Simulates key release on the widget</li>
            <li><code>keyClick(modifiers,key)</code>: Simulates key click on the widget</li>
            <li><code>keyClicks(modifiers,text)</code>: Simulates key click on the widget</li>
            <li><code>waitForShown()</code>: Waits for widget to be shown</li>
            <li><code>wheel(factor,modifiers)</code>: Simulates a wheel event on the widget</li>
            <li><code>wheelAtPos(x,y,factor,modifiers)</code>: Simulates a wheel event on the widget at a
            specific position</li>
            <li><code>show()</code>: Shows the widget</li>
            <li><code>hide()</code>: Hides the widget</li>
        </ul>
    </td>
</tr>
<tr>
    <td><code>QGraphicsObject</code></td>
    <td>
        <ul>
            <li>Inherits properties and functions from <code>QObject</code></li>
            <li><code>center</code>: returns an object whose x and y properties return contain the center of the item</li>
            <li><code>rect</code>: returns an object whose x, y, width and height properties contain the rectangle of
            the item with respect to the scene</li>
            <li><code>mousePress(button,modifiers)</code></li>
            <li><code>mousePressAtPos(x,y,button,modifiers)</code></li>
            <li><code>mouseRelease(button,modifiers)</code></li>
            <li><code>mouseReleaseAtPos(x,y,button,modifiers)</code></li>
            <li><code>mouseMove(x,y)</code></li>
            <li><code>mouseClick(button,modifiers)</code></li>
            <li><code>mouseClickAtPos(x,y,button,modifiers)</code></li>
            <li><code>wheel(factor,modifiers)</code></li>
            <li><code>wheelAtPos(x,y,factor,modifiers)</code></li>
        </ul>
    </td>
</tr>
</tbody>
</table>
</p>
<h3><a class="anchor" id="gcf_investigator_agent_24"></a>
interface(name)</h3>
<p>This function takes as input name of a class or interface and returns an object that implements the interface. Example:</p>
<div class="fragment"><div class="line"><span class="keyword">function</span> test_function() {</div>
<div class="line">    var obj = interface(<span class="stringliteral">&quot;GCF::IGDriveLite&quot;</span>)</div>
<div class="line">    if(obj) {</div>
<div class="line">        ....</div>
<div class="line">    }</div>
<div class="line">}</div>
</div><!-- fragment --><h3><a class="anchor" id="gcf_investigator_agent_25"></a>
wait(milliseconds)</h3>
<p>This function spin waits for as many milliseconds as specified in the parameter. During the spin-wait the event loop will be running.</p>
<h3><a class="anchor" id="gcf_investigator_agent_26"></a>
waitForSignal(object,signal,timeout)</h3>
<p>This function waits for emission of a <code>signal</code> in an <code>object</code> for a maximum <code>timeout</code> milliseconds duration. The function returns an object whose properties are parameters emitted by the signal. Example:</p>
<div class="fragment"><div class="line"><span class="keyword">function</span> test_function() {</div>
<div class="line">    var webView = interface(<span class="stringliteral">&quot;QWebView&quot;</span>)</div>
<div class="line">    var sigObj = waitForSignal(webView, &quot;titleChanged(QString)&quot;, 5000)</div>
<div class="line">    if(sigObj === false)</div>
<div class="line">        log(&quot;signal was not emitted within 5 seconds&quot;)</div>
<div class="line">    else</div>
<div class="line">        log(&quot;title was &quot; + sigObj.title)</div>
<div class="line">}</div>
</div><!-- fragment --><h3><a class="anchor" id="gcf_investigator_agent_27"></a>
waitForPropertyChange(object,property,timeout)</h3>
<p>This function waits for a change in <code>property</code> to occur in <code>object</code> for a max of <code>timeout</code> milliseconds The function returns value of the property, if a change was detected, false otherwise. Example:</p>
<div class="fragment"><div class="line"><span class="keyword">function</span> test_function() {</div>
<div class="line">    var webView = interface(<span class="stringliteral">&quot;QWebView&quot;</span>)</div>
<div class="line">    var title = waitForPropertyChange(webView, &quot;title&quot;, 5000)</div>
<div class="line">    if(title === false)</div>
<div class="line">        log(&quot;title did not change within 5 seconds&quot;)</div>
<div class="line">    else</div>
<div class="line">        log(&quot;title changed to &quot; + title)</div>
<div class="line">}</div>
</div><!-- fragment --><h3><a class="anchor" id="gcf_investigator_agent_28"></a>
compare(v1,v2,msg)</h3>
<p>This function compares <code>v1</code> with <code>v2</code>. If the values were equal then the function returns otherwise it prints <code>msg</code> and terminates the calling test function immediately.</p>
<h3><a class="anchor" id="gcf_investigator_agent_29"></a>
verify(condition,msg)</h3>
<p>This function does nothing if <code>condition</code> is true. It prints <code>msg</code> and terminates the calling test function immediately, otherwise.</p>
<h3><a class="anchor" id="gcf_investigator_agent_210"></a>
createSignalSpy(object,signal)</h3>
<p>This function creates a signal-spy on <code>signal</code> of <code>object</code> and returns the spy. On the returned spy object you can invoke</p>
<ul>
<li><code>wait(timeout)</code> function to wait for <code>timeout</code> milliseconds for a signal emission to occur. The function would return true if a emission was detected within the timout, false otherwise. </li>
<li><code>count</code> property to find out then number of emissions captured by the spy </li>
<li><code>at(index)</code> function to fetch a array of parameters from the <code>index</code> 'th emission </li>
<li><code>takeAt(index)</code> function same as index, but this function removes the <code>index</code> 'th emission from the spy </li>
<li><code>clear()</code> function to remove all emissions from the spy</li>
</ul>
<p>Example:</p>
<div class="fragment"><div class="line"><span class="keyword">function</span> test_function() {</div>
<div class="line">    var spy = createSignalSpy( interface(<span class="stringliteral">&quot;QWebView&quot;</span>), <span class="stringliteral">&quot;titleChanged(QString)&quot;</span> )</div>
<div class="line">    ...</div>
<div class="line">    ...</div>
<div class="line">    <span class="keywordflow">if</span>( spy.wait() ) {</div>
<div class="line">        var title = spy.takeAt( spy.count-1 )[0]</div>
<div class="line">        <span class="comment">// ...</span></div>
<div class="line">    }</div>
<div class="line">}</div>
</div><!-- fragment --><h1><a class="anchor" id="gcf_investigator_script"></a>
GCF Investigator - Test Script</h1>
<p>The script executed by <b>Agent</b> component on the AUT is called "Test Script". Test scripts are JavaScript files that have a bunch of <code>test_xxx()</code> functions. These test functions are called one after the other, in the same order that they are declared. In addition to the <code>test_xxx()</code> functions, a test script can also contain the following optional functions</p>
<ul>
<li><code>initTestCase()</code> - this function is called before any other test function in the script </li>
<li><code>init()</code> - this function is called before each test function in the script </li>
<li><code>cleanup()</code> - this function is called after each test function in the script </li>
<li><code>cleanupTestCase()</code> - this function is called after all test functions have been called in the script</li>
</ul>
<p><b>NOTE:</b> it is perfectly fine to have other functions in the test script. As long as they dont start with <code>test_</code> they are not automatically called by the <b>Agent</b> component.</p>
<h1><a class="anchor" id="gcf_investigator_recorder"></a>
GCF Investigator - Recorder</h1>
<p>The <b>Recorder</b> application simplifies the process of launching an AUT and recording user actions into a test script. Usage:</p>
<pre class="fragment">$GCFDIR/Investigator/Recorder &lt;AUT&gt; [output-test-script] [--autArgs &lt;arg1&gt; [arg2] [arg3] ...]
</pre><p>Here</p>
<ul>
<li><code>AUT</code> is a required command-line argument. It must contain the complete path of AUT. </li>
<li><code>output-test-script</code> is an optional command-line argument that could contain the path of the test script file into which the captured user actions are dumped. </li>
<li>Arguments passed after &ndash;autArgs are passed as command line arguments to the AUT as is</li>
</ul>
<p>The advantage of using <b>Recorder</b> is that it can report AUT crashes on the terminal, to which you can respond and do something about.</p>
<h1><a class="anchor" id="gcf_investigator_runner"></a>
GCF Investigator - Runner</h1>
<p>The <b>Runner</b> application simplifies the process of launching an AUT and running a test-script on it. Usage:</p>
<pre class="fragment">$GCFDIR/Investigator/Runner &lt;AUT&gt; &lt;test-script&gt; [startup-delay] [--autArgs &lt;arg1&gt; [arg2] [arg3] ...]
</pre><p>Here</p>
<ul>
<li><code>AUT</code> is a required command-line argument. It must contain the complete path of AUT. </li>
<li><code>test-script</code> is required command-line argument that should contain the path of the test script file, which needs to be executed on the AUT. </li>
<li><code>startup-delay</code> is an optional command-line argument that would specify the number of seconds to wait before running the script on AUT. </li>
<li>Arguments passed after &ndash;autArgs are passed as command line arguments to the AUT as is</li>
</ul>
<p>The advantage of using <b>Runner</b> is that it can report AUT crashes on the terminal, to which you can respond and do something about. </p>
</div></div><!-- contents -->
</div><!-- PageDoc -->
<div class="ttc" id="aclass_g_c_f_1_1_component_html_ac8791368cb9615392e6c9c2d380034f1"><div class="ttname"><a href="class_g_c_f_1_1_component.html#ac8791368cb9615392e6c9c2d380034f1">GCF::Component::addContentObject</a></div><div class="ttdeci">void addContentObject(const QString &amp;name, QObject *object, const QVariantMap &amp;info=QVariantMap())</div><div class="ttdef"><b>Definition:</b> Component.cpp:577</div></div>
<div class="ttc" id="aclass_g_c_f_1_1_component_html"><div class="ttname"><a href="class_g_c_f_1_1_component.html">GCF::Component</a></div><div class="ttdoc">Base class for all GCF components.</div><div class="ttdef"><b>Definition:</b> Component.h:52</div></div>
<div class="ttc" id="aclass_g_c_f_1_1_gui_application_html"><div class="ttname"><a href="class_g_c_f_1_1_gui_application.html">GCF::GuiApplication</a></div><div class="ttdoc">Extends GCF::Application for GUI Applications.</div><div class="ttdef"><b>Definition:</b> GuiApplication.h:44</div></div>
<div class="ttc" id="aclass_g_c_f_1_1_component_html_a06e3573f06292a5211b81201ced61deb"><div class="ttname"><a href="class_g_c_f_1_1_component.html#a06e3573f06292a5211b81201ced61deb">GCF::Component::load</a></div><div class="ttdeci">void load()</div><div class="ttdef"><b>Definition:</b> Component.cpp:522</div></div>
</div>
</div>
</div>
<div class="footer_content">
<table width="100%" class="footer">
<tr>
<td align="left" width="50%">Copyright &copy; 2013-2019,
 <a class="el" href="http://www.vcreatelogic.com" target="_black">VCreate Logic Private Limited</a></td>
<td align="right" width="50%"><a class="el" href="http://www.vcreatelogic.com/products/gcf" target="_black">GCF - Generic Component Framework</a></td>
</tr>
</table>
</div>
</div>
</body>
</html>
